package com.liancheng.smarthome.bean.module;

import android.databinding.ObservableBoolean;
import android.databinding.ObservableField;

import com.liancheng.smarthome.R;
import com.liancheng.smarthome.utils.appcommon.AppCommonUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * 标题的选择实体类
 */
public class AlarmListChooseBean {

    public final ObservableField<String> titleName = new ObservableField<>();
    public String id;
    public final ObservableBoolean chooseThis=new ObservableBoolean();

    public AlarmListChooseBean(String id,String name){
        this.id=id;
        this.titleName.set(name);
    }

    public int textColorNormal= R.color.color_0E1A3A;
    public int textColorSelected= R.color.color_blue18;

    //构建产品列表数据
    public static List<AlarmListChooseBean> mergeChanpinClassBeanList(List<ChanpinClassBean> chanpinClassList){
        List<AlarmListChooseBean> chooseBeanList = new ArrayList<>();
        if(AppCommonUtils.arrayIsEmtry(chanpinClassList)) return chooseBeanList;

        for (int i = 0; i < chanpinClassList.size(); i++) {
            ChanpinClassBean classBean = chanpinClassList.get(i);
            chooseBeanList.add(new AlarmListChooseBean(classBean.getProductId(),
                    classBean.getProductModel()));
        }

        return chooseBeanList;
    }

    //构建产品列表数据
    public static List<AlarmListChooseBean> mergeCompanyClassBeanList(List<CompanyClassBean> companyClassList){
        List<AlarmListChooseBean> chooseBeanList = new ArrayList<>();
        if(AppCommonUtils.arrayIsEmtry(companyClassList)) return chooseBeanList;

        for (int i = 0; i < companyClassList.size(); i++) {
            CompanyClassBean companyClassBean = companyClassList.get(i);
            chooseBeanList.add(new AlarmListChooseBean(companyClassBean.getId(),
                    companyClassBean.getCompanyName()));
        }
        return chooseBeanList;
    }
    //构建客户列表数据
    public static List<AlarmListChooseBean> mergeCustomerClassBeanList(List<CustomerClassBean> customerClassList){
        List<AlarmListChooseBean> chooseBeanList = new ArrayList<>();
        if(AppCommonUtils.arrayIsEmtry(customerClassList)) return chooseBeanList;

        for (int i = 0; i < customerClassList.size(); i++) {
            CustomerClassBean customerClassBean = customerClassList.get(i);
            chooseBeanList.add(new AlarmListChooseBean(customerClassBean.getId(),
                    customerClassBean.getCustomerName()));
        }
        return chooseBeanList;
    }
    //构建客户列表数据
    public static List<AlarmListChooseBean> mergeCProjectClassBeanList(List<CProjectClassBean> cCProjectClassList){
        List<AlarmListChooseBean> chooseBeanList = new ArrayList<>();
        if(AppCommonUtils.arrayIsEmtry(cCProjectClassList)) return chooseBeanList;

        for (int i = 0; i < cCProjectClassList.size(); i++) {
            CProjectClassBean cProjectClassBean = cCProjectClassList.get(i);
            chooseBeanList.add(new AlarmListChooseBean(cProjectClassBean.getId(),
                    cProjectClassBean.getProjectName()));
        }
        return chooseBeanList;
    }

}
